<!DOCTYPE html>
<html lang="en">
<head th:include="certificateWeb/headFoot :: headerCss">
</head>
<!--<link href="/css/web/themes/about.css" rel="stylesheet">-->
<link rel="stylesheet" href="/css/certificateWeb/workNews/workNews.css">

<link type="text/css" href="/css/cultivateWeb/style/my.css" rel="stylesheet">
<body th:if="${resume!=''}">
<div th:include="certificateWeb/headFoot :: header"></div>
<main id="main" >
    <section class="sec_1">
        <div class="div_1">
            <ul>
                    <li><a href="/certificate/my">个人信息</a></li>
                    <li class="this"><a href="/certificate/isResume">我的简历</a></li>
                    <li><a href="/certificate/infoRecordList">表单提交记录</a></li>
                    <li><a href="/certificate/expertRecordList">专家申请记录</a></li>
                    <li><a href="/certificate/stationRecordList">考核站点申请记录</a></li>
                    <li><a href="/certificate/stationPxRecordList">培训基地申请记录</a></li>
                    <li><a href="/certificate/gradeQuery">成绩查询</a></li>
                    <li><a href="/certificate/message">消息中心</a></li>
                    <li onclick="mock2(this)" data-type="2"><a>幼儿照护初级模拟考试</a></li>
                    <li onclick="mock2(this)" data-type="1"><a>幼儿照护中级模拟考试</a></li>
                    <li onclick="mock2(this)" data-type="0"><a>幼儿照护高级模拟考试</a></li>
                </ul>
            </div>
            <div class="div_2" style="padding: 10px">
                <!--                <form id="formId">-->
                <div style="width:940px; margin: 40px auto 20px auto">
                    <span style="float: right;margin-right: 20px; margin-bottom: 30px">
                         <label style="color: #666">注：部分信息需要到个人资料去修改</label>
                        <input class="edit" onclick="save();" type="button" value="保存"/>&nbsp;&nbsp;&nbsp;
                    </span>
                </div>
                <div class="jl_1">
                    <div class="jl_2" style="width: 100%">
                        <span style="width: 920px;display:inline-block"><img src="" id="img" class="jl_img"></span>
                        <span class="jl_name" id="name"></span>
                        <!--                    <span class="jl_jb">男 | 22岁 | 2年工作经验</span>-->
                    </div>
                </div>
                <div style="clear: both"></div>
                <div class="jl_xx">
                    <span class="jl_xx_1">个人信息</span>
                    <hr class="jl_hr"/>
                    <div style="margin-top:15px">
                        <span class="jl_xx_2">籍&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;贯：
                            <input class="jl_ipt" style="height: 40px;width: 225px" type="text" id="nativePlace"/>
                        </span>
                        <span class="jl_xx_2">毕业学校：
                            <input class="jl_ipt" style="height: 40px;width: 225px" type="text" id="graduatedFrom"/>
                        </span>
                        <span class="jl_xx_2">期望职业：
                            <input class="jl_ipt" style="height: 40px;width: 225px" type="text" id="desiredOccupation"/>
                        </span>
                        <span class="jl_xx_2">期望薪资：
                            <select id="expectedSalary" class="jl_ipt">
                               <option value="1000-3000元">1000-3000元</option>
                               <option value="3000-5000元">3000-5000元</option>
                               <option value="5000-8000元">5000-8000元</option>
                                <option value="8000-10000元">8000-10000元</option>
                                <option value="10000-20000元">10000-20000元</option>
                                <option value="20000元以上">20000元以上</option>
                           </select>
                           </span>
                        <span class="jl_xx_2">工作年限：
                            <input class="jl_ipt" style="height: 40px;width: 225px" id="workYears" type="text"/>
                        </span>
                        <span class="jl_xx_2">工作性质：
                            <select id="jobNature" class="jl_ipt">
                                <option value="0">全职</option>
                                <option value="1">兼职</option>
                                <option value="2">实习</option>
                            </select>
                        </span>
                        <span class="jl_xx_2">求职状态：
                            <select id="applyState" class="jl_ipt">
                               <option value="0">立即到岗</option>
                               <option value="1">月内到岗</option>
                               <option value="2">考虑机会</option>
                               <option value="3">暂不考虑</option>
                            </select>
                        </span>
                        <span class="jl_xx_2">工作地点：
                            <input class="jl_ipt" style="height: 40px;width: 225px" id="jobAddress" type="text"/>
                        </span>
                        <span class="jl_xx_2">是否推送：
                            <select id="isPush" class="jl_ipt">
                               <option value="0">否</option>
                               <option value="1">是</option>
                            </select>
                        </span>
                    </div>
                </div>
                <div style="">
                    <span class="jl_xx_1">教育经历</span>
                    <hr class="jl_hr"/>
                    <div id="box">
                        <div style="margin-top:20px" class="jyjl">
                        <span class="jl_sclTime">
                            <input type="text" onclick="WdatePicker({dateFmt:'yyyy年MM月'})" id="start"  class="jl_ipt rxTime" placeholder="入学时间"/>- &nbsp;&nbsp;
                            <input type="text" onclick="WdatePicker({dateFmt:'yyyy年MM月'})" id="finish" class="jl_ipt byTime" placeholder="毕业时间"/>
                        </span>
                            <span class="jl_school" style="width:360px"><input type="text" class="jl_ipt bySchool"
                                                                               placeholder="请输入学校名"/></span>
                        </div>
                    </div>

                    <div style="text-align: center">
                        <p><input type="button" onclick="insert()" class="insert" value="新增"/></p>
                    </div>
                </div>
                <div>
                    <span class="jl_xx_1">工作经历</span>
                    <hr class="jl_hr"/>
                    <div id="gzjl">
                        <div style="margin-top:20px" class="gzjl">
                        <span class="jl_sclYear">
                            <input type="text" onclick="WdatePicker({dateFmt:'yyyy年MM月'})" class="jl_ipt rzTime" placeholder="入职时间"/>- &nbsp;&nbsp;
                            <input type="text" onclick="WdatePicker({dateFmt:'yyyy年MM月'})" class="jl_ipt lzTime" placeholder="离职时间"/>
                        </span>
                            <span class="jl_gs"><input type="text" style="width: 300px" class="jl_ipt gsName"
                                                       placeholder="公司名"/></span>
                            <span class="jl_zw">
                            职位：<input type="text" class="jl_ipt zwName" placeholder="职位名"/> &nbsp;&nbsp;
                            薪资：<input type="text" class="jl_ipt xsNum" placeholder="薪资"/>/月</span>
                            <span class="jl_ms">
                            <textarea class="jl_tarea zwDescribe" placeholder="职位描述" maxlength="800"></textarea>
                        </span>
                        </div>
                    </div>
                    <div style="text-align: center">
                        <p><input type="button" onclick="insert1()" class="insert" value="新增工作经历"/></p>
                    </div>
                </div>
                <div>
                    <span class="jl_xx_1">项目经验</span>
                    <hr class="jl_hr"/>
                    <div id="xmjy">
                        <div style="margin-top:20px" class="xmjy">
                        <span class="jl_sclYear">
                            <input type="text" class="jl_ipt xmStartTime" onclick="WdatePicker({dateFmt:'yyyy年MM月'})" placeholder="开始时间"/>- &nbsp;&nbsp;
                            <input type="text" class="jl_ipt xmEndTime" onclick="WdatePicker({dateFmt:'yyyy年MM月'})" placeholder="结束时间"/>
                        </span>
                            <span class="jl_gs"><input type="text" class="jl_ipt xmName" style="width: 300px"
                                                       placeholder="项目名"/></span>
                            <span class="jl_ms">
                            <textarea class="jl_tarea xmDescribe" placeholder="项目描述" maxlength="800"></textarea>
                        </span>
                        </div>
                    </div>
                    <div style="text-align: center">
                        <p><input type="button" onclick="insert2()" class="insert" value="新增项目经验"/></p>
                    </div>
                </div>
                <div>
                    <span class="jl_xx_1">荣获证书</span>
                    <hr class="jl_hr"/>
                    <div id="rhzs">
                        <div style="margin-top:20px;width: 100%" class="rhzs">
                            <span class="jl_zs"><input type="text" class="jl_ipt zsName" style="width: 300px"
                                                       placeholder="证书名"/></span>
                            <span class="jl_date"><input type="text" class="jl_ipt zsTime" onclick="WdatePicker({dateFmt:'yyyy年MM月'})" placeholder="获得年月"/></span>
                        </div>
                    </div>
                    <div style="text-align: center">
                        <p><input type="button" onclick="insert3()" class="insert" value="新增荣获证书"/></p>
                    </div>
                </div>
                <div style="margin-bottom: 70px">
                    <span class="jl_xx_1">专业技能</span>
                    <hr class="jl_hr"/>
                    <div style="margin-top:20px">
                        <span class="jl_ms">
                            <textarea class="jl_tarea" id="skills" placeholder="专业技能描述（限500字以内）" maxlength="500"></textarea>
                        </span>
                    </div>
                </div>
                <div style="margin-bottom: 50px">
                    <span class="jl_xx_1">自我评价</span>
                    <hr class="jl_hr"/>
                    <div style="margin-top:20px">
                        <span class="jl_ms">
                            <textarea class="jl_tarea" id="selfEvaluation" placeholder="自我评价（限500字以内）"
                                      maxlength="500"></textarea>
                        </span>
                    </div>
                </div>
                <div style="margin-bottom:30px;text-align: center"><input class="edits" onclick="save();" type="button" value="保存"/>&nbsp;&nbsp;&nbsp;</div>
                <!--                </form>-->
            </div>
            <div style="clear: both;"></div>
        </section>
</main>
    </div>
    <div style="margin-bottom: 50px;display: inline-block"></div>
    <!-- 分页 -->
</div>
<!-- footer ------------------------------------------------------- -->
<div th:include="certificateWeb/headFoot :: footer"></div>
</body>
<script src="/js/layui/lay/modules/layer.js"></script>
<script src="//s.xlongwei.com/res/js/My97DatePicker/WdatePicker.js"></script>
<script src="/js/plugins/validate/jquery.validate.extend.js"></script>
<script src="/js/plugins/validate/jquery.validate.min.js"></script>
<script src="/js/layui/layui.js"></script>
<script type="text/javascript" src="/js/bootstrap.min.js"></script>
<script type="text/javascript" src="/js/mobile.js"></script>
<script>

    $(function () {
        ajaxToken("/jzApi/user/selUserDetail", "GET", {}, function (r) {
            if (r != null) {
                $('#name').text(r.name);
                $('#img').attr("src", r.headPortrait);
            }

        });

    });
    $("#start").blur(function(){
        var start = $('#start').val()
        var finish = $('#finish').val()
        var s = start.substr(0, 4)
        var f = finish.substr(0,4)
        var t = f-s
        if(t <2 && t<'2'){
            // layer.msg('请输入正确的时间');
            return false
        }
    });
    $("#finish").blur(function(){
    var start = $('#start').val()
    var finish = $('#finish').val()
    var s = start.substr(0, 4)
    var f = finish.substr(0,4)
    var t = f-s
        if(t <2 && t<'2'){
            layer.msg('请输入正确的时间');
            return false
        }
    });
    function save() {
        var workYears = $("#workYears").val();
        var nativePlace = $("#nativePlace").val();
        var desiredOccupation = $('#desiredOccupation').val();
        var applyState = $("#applyState").val();
        var graduatedFrom = $("#graduatedFrom").val();
        var expectedSalary = $("#expectedSalary").val();
        var jobAddress = $('#jobAddress').val();
        var selfEvaluation = $("#selfEvaluation").val();
        var isPush = $('#isPush').val();
        var jobNature = $("#jobNature").val();
        var skills = $('#skills').val();
        /*if(workYears=='' || nativePlace==''||desiredOccupation==''||applyState==''||graduatedFrom=='' ||
            expectedSalary == '' || jobAddress == '' || selfEvaluation == '' || isPush == '' ||
            jobNature == '' || skills == ''){
            layer.msg("基本信息不能为空");
            return false
        }*/
        if (workYears == '') {
            layer.msg("工作年限不能为空");
            return false
        }
        if (nativePlace == '') {
            layer.msg("籍贯不能为空");
            return false
        }
        if (desiredOccupation == '') {
            layer.msg("期望职业不能为空");
            return false
        }
        if (applyState == '') {
            layer.msg("求职状态不能为空");
            return false
        }
        if (graduatedFrom == '' || graduatedFrom.length<4) {
            layer.msg("请填写毕业学校");
            return false
        }
        if (expectedSalary == '') {
            layer.msg("期望薪资不能为空");
            return false
        }
        if (jobAddress == '') {
            layer.msg("工作地点不能为空");
            return false
        }
        if (isPush == '') {
            layer.msg("是否推送不能为空");
            return false
        }
        if (jobNature == '') {
            layer.msg("工作性质不能为空");
            return false
        }
        if (skills == '' || skills.length<50) {
            layer.msg("专业技能不能少于50个字符");
            return false
        }
        if (selfEvaluation == '' || selfEvaluation.length<50) {
            layer.msg("自我评价不能少于50个字符");
            return false
        }


        //------------------------教育经历---------------------------//
        var jyjlList = [];
        var jyjl = true;
        $(".jyjl").each(function (item, index) {
            var rxTime = $(this).find(".rxTime").val();
            var byTime = $(this).find(".byTime").val();
            var bySchool = $(this).find('.bySchool').val();
            if (rxTime == '' || byTime == '' || bySchool == '') {
                layer.msg('教育经历填写不完整');
                jyjl = false;
                // return false
            }
            jyjlList.push({rxTime: rxTime, byTime: byTime, bySchool: bySchool});
        })
        if (jyjl == false) {
            return jyjl;
        }
        //---------------------------工作经历---------------------------//
        var gzjlList = [];
        var gzjl = true;
        $(".gzjl").each(function (item, index) {
            var rzTime = $(this).find(".rzTime").val();
            var lzTime = $(this).find(".lzTime").val();
            var gsName = $(this).find('.gsName').val();
            var zwName = $(this).find('.zwName').val();
            var xsNum = $(this).find('.xsNum').val();
            var zwDescribe = $(this).find('.zwDescribe').val();
            // if (rzTime == '' || lzTime == '' || gsName == '' || zwName == '' || xsNum == '' || zwDescribe == '') {
            //     layer.msg('工作经历填写不完整');
            //     gzjl = false;
            // }
            // console.log("rzTime" , rzTime)
            gzjlList.push({
                rzTime: rzTime,
                lzTime: lzTime,
                gsName: gsName,
                zwName: zwName,
                xsNum: xsNum,
                zwDescribe: zwDescribe
            });
        })
        if (gzjl == false) {
            return gzjl;
        }

        //---------------------------项目经验---------------------------//
        var xmjyList = [];
        var xmjy = true;
        $(".xmjy").each(function (item, index) {
            var xmStartTime = $(this).find(".xmStartTime").val();
            var xmEndTime = $(this).find(".xmEndTime").val();
            var xmName = $(this).find('.xmName').val();
            var xmDescribe = $(this).find('.xmDescribe').val();
            // if (xmStartTime == '' || xmEndTime == '' || xmName == '' || xmDescribe == '') {
            //     layer.msg('项目经验填写不完整');
            //     xmjy = false;
            // }
            xmjyList.push({xmStartTime: xmStartTime, xmEndTime: xmEndTime, xmName: xmName, xmDescribe: xmDescribe});
        })
        if (xmjy == false) {
            return xmjy;
        }

        //---------------------------荣获证书---------------------------//
        var rhzsList = [];
        var rhzs = true;
        $(".rhzs").each(function (item, index) {
            var zsName = $(this).find(".zsName").val();
            var zsTime = $(this).find(".zsTime").val();
            // if (zsName == '' || zsTime == '') {
            //     layer.msg('荣获证书填写不完整');
            //     rhzs = false;
            // }
            rhzsList.push({zsName: zsName, zsTime: zsTime});
        })
        if (rhzs == false) {
            return rhzs;
        }
        // console.log("JSON.stringify(jyjlList)", JSON.stringify(jyjlList))
        //          json 转string                                          string转json
        ajaxToken("/jzApi/recruitment/updResume", 'POST', {
            workYears: workYears,
            nativePlace: nativePlace,
            graduatedFrom: graduatedFrom,
            desiredOccupation: desiredOccupation,
            expectedSalary: expectedSalary,
            applyState: applyState,
            jobAddress: jobAddress,
            isPush: isPush,
            jobNature: jobNature,
            skills: skills,
            selfEvaluation: selfEvaluation,
            educationExperience: JSON.stringify(jyjlList),
            workExperience: JSON.stringify(gzjlList),
            project: JSON.stringify(xmjyList),
            certificate: JSON.stringify(rhzsList)
        }, function (res) {
            location.href = '/certificate/isResume';
        })
    }

    function insert() {
        $('#box').append('<div style="margin-top:20px" class="jyjl">' +
            '                        <span class="jl_sclTime">' +
            '                            <input type="text" class="jl_ipt rxTime" onclick="WdatePicker({dateFmt:\'yyyy年MM月\'})" placeholder="入学时间"/>- &nbsp;&nbsp;' +
            '                            <input type="text" class="jl_ipt byTime" onclick="WdatePicker({dateFmt:\'yyyy年MM月\'})"  placeholder="毕业时间"/>' +
            '                        </span>' +
            '                        <span class="jl_school" style="width: 360px"><input type="text" class="jl_ipt bySchool" placeholder="请输入学校名" /></span>' +
            '                        <span class="del" id="del">删除</span>' +
            '                    </div>');
        $('.del').click(function () {
            $(this).parent('.jyjl').remove()
        })
    }


    function insert1() {
        $('#gzjl').append('<div style="margin-top:20px" class="gzjl">' +
            '                        <span class="jl_sclYear">' +
            '                            <input type="text" class="jl_ipt rzTime" onclick="WdatePicker({dateFmt:\'yyyy年MM月\'})" placeholder="开始时间"/>- &nbsp;&nbsp;' +
            '                            <input type="text" class="jl_ipt lzTime" onclick="WdatePicker({dateFmt:\'yyyy年MM月\'})" placeholder="结束时间"/>' +
            '                            <span class="del">删除</span>' +
            '                        </span>' +
            '                        <span class="jl_gs"><input type="text" style="width: 300px" class="jl_ipt gsName" placeholder="公司名" /></span>' +
            '                        <span class="jl_zw">' +
            '                            职位：<input type="text" class="jl_ipt zwName" placeholder="职位名" /> &nbsp;&nbsp;' +
            '                            薪资：<input type="text" class="jl_ipt xsNum" placeholder="薪资" />/月</span>' +
            '                        <span class="jl_ms">' +
            '                            <textarea class="jl_tarea zwDescribe" placeholder="职位描述" maxlength="800"></textarea>' +
            '                        </span>' +
            '                    </div>');
        $('.del').click(function () {
            $(this).parent('.jl_sclYear').parent('.gzjl').remove()
        })
    }

    function insert2() {
        $('#xmjy').append('<div style="margin-top:20px" class="xmjy">' +
            '                        <span class="jl_sclYear">' +
            '                            <input type="text" class="jl_ipt xmStartTime" onclick="WdatePicker({dateFmt:\'yyyy年MM月\'})" placeholder="开始时间"/>- &nbsp;&nbsp;' +
            '                            <input type="text" class="jl_ipt xmEndTime" onclick="WdatePicker({dateFmt:\'yyyy年MM月\'})" placeholder="结束时间"/>' +
            '                            <span class="del">删除</span>' +
            '                        </span>' +
            '                        <span class="jl_gs"><input type="text" class="jl_ipt xmName" style="width: 300px" placeholder="项目名" /></span>' +
            '                        <span class="jl_ms">' +
            '                            <textarea class="jl_tarea xmDescribe" placeholder="项目描述" maxlength="800"></textarea>' +
            '                        </span>' +
            '                    </div>');
        $('.del').click(function () {
            $(this).parent('.jl_sclYear').parent('.xmjy').remove()
        })
    }

    function insert3() {
        $('#rhzs').append('<div style="margin-top:20px;width: 100%" class="rhzs">' +
            '                        <span class="jl_zs"><input type="text" class="jl_ipt zsName" style="width: 300px" placeholder="证书名" /></span>' +
            '                        <span class="jl_date"><input type="text" onclick="WdatePicker({dateFmt:\'yyyy年MM月\'})" class="jl_ipt zsTime" placeholder="获得年月" /></span>' +
            '                        <span class="del">删除</span>' +
            '                    </div>');
        $('.del').click(function () {
            $(this).parent('.rhzs').remove()
        })
    }

    function validateRule() {
        var icon = "<i style='color: red;font-size: 14px'>";
        $("#formId").validate({
            rules: {
                experience: {
                    required: true
                }
            }
        })
    }
</script>
</html>